.org 0xE6818 ; Damage from Cannons

Damage_From_Cannons:

	PUSH 	{R4, LR}
	
	LDR 	R3, [Damage_From_Cannons_1]
	LDR 	R2, [Damage_From_Cannons_2]
	LDR 	R12, [R3, 0]
	LDR 	R2, [R2, 0]
	
	MOV		R3, 0x98
	ADD		R2, R12, R2, LSL 2
	LDR		R2, [R2, 0x48]
	MOV		R4, 0
	ADD 	R2, R2, 0x5000
	LDR 	R2, [R2, 0xA58]
	MLA 	R2, R0, R3, R2
	ADD 	R0, R2, 0x74
	ADD		R0, R0, R1, LSL 4
	
	MOV 	R1, Rank_Cannon_Guard				; Rank: Cannon Guard	
	
	BL 		Check_Skills_Equipped				; Check the Skill is equipped
	
	CMP 	R0, 0								; Does CO use that skill?
	ADDNE 	R4, R4, 20							; If CO use skill, -2 damage from Cannons

	MOV 	R0, R4
	
	POP 	{R4, LR}	
	BX 		LR

;-------------------------------------------------------------------------------		

Damage_From_Cannons_1:
	.dw Reg1_Skill
	
Damage_From_Cannons_2:
	.dw Reg2_Skill



